package shujia.day08;

/*
    StringBuffer作为参数传递
 */
public class StringBufferDemo4 {
    public static void main(String[] args) {
        StringBuffer sb1 = new StringBuffer("hello");
        StringBuffer sb2 = new StringBuffer("world");
        System.out.println("sb1: "+sb1+", sb2: "+sb2);// sb1: hello,sb2: world
        change(sb1,sb2);
        System.out.println("sb1: "+sb1+", sb2: "+sb2);// sb1: hello,sb2: worldworld
    }

    public static void change(StringBuffer sb1,StringBuffer sb2){
        System.out.println("sb1: "+sb1+", sb2: "+sb2);// sb1: hello,sb2: world
        sb1 = sb2;
        sb2.append(sb1);
        System.out.println("sb1: "+sb1+", sb2: "+sb2);// sb1: worldworld,sb2: worldworld
    }
}
